#include "string.h"

#include <iostream>
#include <string>
using namespace std;


void testmystring1()
{
	mystr::string s ( "hello world");
	mystr::string s1(s);
	mystr::string s2 = s;
	const char* p = s.c_str();
	const char* q = s2.c_str();

	cout << p << endl;
	cout << q << endl;
}


void testmystring2()
{

	mystr::string s = "hello world";

	mystr::string::iterator  it = s.begin();

	while (it != s.end())
	{
		cout << *it << " ";
		it++;
	}
}



void testmystring3()
{
	string  s = "hello world";
	//s.reserve(20);

	//s.reserve(10);
	//cout << s << endl;
	//cout << s.capacity() << endl;
	
	s.resize(4);
	cout << s << endl;



}

void testmystring4()
{
	mystr::string s = "hello world";

	s.resize(5);

	for (int i = 0; i < s.size(); i++)
	{

		cout << s[i] ;

	}
	cout << endl;
	cout << s[1] << endl;

}


void testmystring5()
{

	mystr::string s = "hello world";
	s += 'x';
	char a[10] = " hello ";	            
	//s += " string";
	mystr::string str = " string";
	s += str;
	//s.append(" hello string");
	const char* p = s.c_str();
	cout << p << endl;



}


void testmystring6()
{
	mystr::string s1 = "hello";
	mystr::string s2 = "helloxxxx";

	cout << (s1 < s2) << endl;
}

void testmystring7()
{
	mystr::string s2 = "hello world";

	s2.insert(1, 'x');
	s2.insert(4, "string");

	const char* p = s2.c_str();

	cout << s2 << endl;

}




void testmystring8()
{
	mystr::string s1 = "hello world";
	mystr::string s2 = "hello earth";

	s1.swap(s2);


	cout << s1 << endl;
}



void testmystring9()
{

	mystr::string s = "hello world";
	mystr::string s1 = " string";

	s.append("string");

	cout << s;
}

void testmystring10()
{

}




int main()
{
	testmystring10();

	return 0;
}


